package com.bocai.freeman.view.activitys;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.widget.ListView;

import com.bocai.freeman.R;
import com.bocai.freeman.base.BaseActivity;
import com.bocai.freeman.utils.ToolbarHelper;
import com.bocai.freeman.view.adapter.MySkillAdatper;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by admin on 2016/5/25.
 */
public class MySkillsActivity extends BaseActivity {

    @Bind(R.id.lv)
    ListView mLv;
    @Bind(R.id.toolbar)
    Toolbar mToolbar;

    private MySkillAdatper mAdatper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_skill);
        ButterKnife.bind(this);
        initEvent();
    }

    @Override
    protected void initEvent() {
        super.initEvent();
        ToolbarHelper.setup(this, R.string.my_skill, R.mipmap.left_return);
        mToolbar.setOnMenuItemClickListener(item -> {
            // TODO: 2016/5/25 do some operation
            startActivity(new Intent(MySkillsActivity.this,SelectSkillActivity.class));
            return true;
        });

        mAdatper = new MySkillAdatper(this);
        mLv.setAdapter(mAdatper);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ButterKnife.unbind(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_add, menu);
        return super.onCreateOptionsMenu(menu);
    }
}
